const { defineConfig } = require("@vue/cli-service")
const path = require('path')
module.exports = defineConfig({
  publicPath: process.env.VUE_APP_PUBLIC_PATH,
  transpileDependencies: true,
  lintOnSave: false,
  devServer: {
    proxy: {
      [process.env.VUE_APP_API_PROXY_PREFIX]: {
        target: process.env.VUE_APP_API_BASE_URL,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_API_PROXY_PREFIX]: ''
        }
      }
    },
    port: 8090
  },
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          modifyVars: {
            // 通过本地less文件覆盖变量
            // hack: `true; @import "./src/theme/index.less";`,
            hack: `true;@import "${path.resolve(__dirname, './src/theme/index.less')}";`
          }
        }
      }
    }
  }
})
